package com.fakesmoker.aidawnda.job;

import com.fakesmoker.aidawnda.model.entity.App;
import com.fakesmoker.aidawnda.service.AppService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class QuestionSyncTask {
/*

    @Autowired
    private RestHighLevelClient esClient;

    @Autowired
    private AppService appService;

    @Scheduled(fixedRate = 60000) // 每分钟同步一次
    public void syncQuestions() {
        List<App> apps = appService.list();
        for (App app : apps) {
            IndexRequest request = new IndexRequest("question_index")
                .id(question.getId().toString())
                .source(
                    "{\"id\":\"" + app.getId() + "\"," +
                    "\"title\":\"" + app.getAppName() + "\"," +
                    "\"update_time\":\"" + app.getUpdateTime().toString() + "\"}",
                    XContentType.JSON
                );
            esClient.index(request, RequestOptions.DEFAULT);
        }
    }
}*/
}
